package com.xintoucloud.pbs.service.impl;

import java.util.List;

import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xintoucloud.pbs.dao.PartyMemberPermissionDao;
import com.xintoucloud.pbs.entity.PartyMemberPermission;
import com.xintoucloud.pbs.model.DataGrid;
import com.xintoucloud.pbs.service.PartyMemberPermissionService;
@Service@Transactional
public class PartyMemberPermissionServiceImpl implements PartyMemberPermissionService{
	@Autowired
	private PartyMemberPermissionDao partyMemberPermissionDao;
	@Override
	public PartyMemberPermission getPartyMemberPermission(int ppid) {
		return  partyMemberPermissionDao.getOne(ppid);
	}
	@Override
	public DataGrid<PartyMemberPermission> listPartyMemberPermission(int pages, int rows) {
		DataGrid<PartyMemberPermission> pmps=new DataGrid<PartyMemberPermission>();
		int pageIndex = (pages - 1) * rows;
		List<PartyMemberPermission> lists=partyMemberPermissionDao.listPartyMemberPermission(pageIndex,rows);
		long count=partyMemberPermissionDao.count();
		pmps.setData(lists);
		pmps.setCount(count);
		if(lists!=null) {
			pmps.setCode(200);
			pmps.setMsg("加载成功");
		}
		return pmps;
	}
	@Override
	public void addPartyMemberPermission(PartyMemberPermission partyMemberPermission) {
		partyMemberPermissionDao.addPartyMemberPermission(partyMemberPermission);
		
	}
	@Override
	public void deletePartyMemberPermission(int ppid) {
		partyMemberPermissionDao.deletePartyMemberPermission(ppid);
		
	}
	@Override
	public void updatePartyMemberPermission(PartyMemberPermission partyMemberPermission) {
		partyMemberPermissionDao.updatePartyMemberPermission(partyMemberPermission);
		
	}

}
